x86: Add broken memory type in p2m table
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 13 Sep 2010 16:47:40 +0000 (17:47 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 13 Sep 2010 16:47:40 +0000 (17:47 +0100)
commit4d94df82fb327ae3d0918db33301bf47db0b44e7
treecf2a0d1cc900ab00b57faf6d43cd504eb94d6ea7
parent2e701b1f87ba03526e0b378649de648c609667b9
x86: Add broken memory type in p2m table

In some platform, whole system will crash if a broken memory is
accessed, no matter this access is from guest, or hypervisor. This may
cause issue if mallicious guest access this memory. To avoid this, we
need to guard the access from the guest. Morever, we need make sure
host will not access the memory for guest, like when do instruction
emulation.

This patch is to guard EPT guest's access. A new broken memory type is
added. Because the ept_p2m_type_to_flags() will mark default type as
r/w/x bit as zero, a broken memory type will have non-present EPT
entry, thus guest's access will cause EPT violation VM Exit.

In Xen hypervisor's vmexit ept violation handler, when it try to
translate the gpfn to mfn through p2m_guest query type, this patch
will cause domain to be crashed.

The changes to __gfn_to_mfn_type will return INVALID_MFN for broken
memory type, to avoid the crash caused by hypervisor access if caller
check the return value. It is complex to test this scenerior in EPT
situation, since mostly EPT violation will happen before hypervisor
will access the broken memory, but to be helpful for other memory
type.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
xen/include/asm-x86/p2m.h